use sea_orm::{Database, DatabaseConnection, DbErr};
use crate::Config;

pub async fn connect(config: &Config) -> Result<DatabaseConnection, DbErr> {
    let database_url = config.database_url();
    Database::connect(&database_url).await
}

pub async fn setup_database(_db: &DatabaseConnection) -> Result<(), DbErr> {
    // 这里可以添加数据库初始化逻辑
    // 比如创建表、索引等
    Ok(())
}